package com.hn.zhijian.base.common.exception;

import com.hn.zhijian.base.common.StatusCode;
import lombok.Data;
import lombok.ToString;

/**
 * @author calr chen
 * @date 2017-03-23
 */
@Data
@ToString
public class ApplicationException extends RuntimeException {

    /**
     * 错误码
     */
    private Integer code;


    public ApplicationException() {

    }

    public ApplicationException(String message) {
        super(message);
    }

    public ApplicationException(StatusCode statusCode) {
        super(statusCode.getMessage());
        this.code = statusCode.getCode();

    }

    public ApplicationException(Integer code) {
        super(StatusCode.getMessage(code));
        this.code = code;

    }

    public ApplicationException(Integer code, String message) {
        super(message);
        this.code = code;
    }

}
